<?php

/**
 * Trabajopractico form base class.
 *
 * @method Trabajopractico getObject() Returns the current form's model object
 *
 * @package    ecampus
 * @subpackage form
 * @author     Grupo 608
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTrabajopracticoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_tp'          => new sfWidgetFormInputHidden(),
      'id_curso'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Curso'), 'add_empty' => true)),
      'calificacion'   => new sfWidgetFormInputText(),
      'titulo'         => new sfWidgetFormInputText(),
      'tipo_trabajo'   => new sfWidgetFormInputText(),
      'estado_trabajo' => new sfWidgetFormInputText(),
      'activo'         => new sfWidgetFormInputText(),
      'archivo'        => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id_tp'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_tp')), 'empty_value' => $this->getObject()->get('id_tp'), 'required' => false)),
      'id_curso'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Curso'), 'required' => false)),
      'calificacion'   => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'titulo'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'tipo_trabajo'   => new sfValidatorString(array('max_length' => 1, 'required' => false)),
      'estado_trabajo' => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'activo'         => new sfValidatorInteger(array('required' => false)),
      'archivo'        => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('trabajopractico[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Trabajopractico';
  }

}
